<!--18-onsubmit事件.html-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>onsubmit事件</title>
    <script type="text/javascript">
        function onsubmitFunc() {
            alert("静态注册..., invalid data.");
            return false;
        }

        window.onload = function () {
            var elementById = document.getElementById("form-01");
            elementById.onsubmit = function () {
                alert("动态注册，返回 true，提交成功");
                return true;
            }
        }
    </script>
</head>
<body>
    <!--  return onsubmitFunc(); 如果 onsubmitFunc() 返回false，不会提交  -->
    <form action="http://localhost:8080" method="get" onsubmit="return onsubmitFunc();">
        <input type="submit" value="静态注册提交表单"/>
    </form>

    <form action="http://localhost:8080" method="get" id="form-01">
        <input type="submit" value="动态注册提交表单"/>
    </form>

</body>
</html>